package com.s06.h01.utils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import com.s06.h01.model.User;


public class UserUtils {


	public static User parse(String string) {
		User user = new User();
		String[] entrys = string.split(",");
		user.setName(entrys[0]);
		user.setSurname(entrys[1]);
	
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
		Date date = null;
		try {
			date = sdf.parse(entrys[2]);
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	
		user.setDob(date);
		Date creationDate = new Date();
	
		user.setCreateDate(creationDate);
		return user;
	}

}